package com.ruoyi.message.service.impl;

import java.util.List;

import com.ruoyi.aiConversation.mapper.AiConversationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.message.mapper.MessageMapper;
import com.ruoyi.message.domain.Message;
import com.ruoyi.message.service.IMessageService;

/**
 * 信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-09
 */
@Service
public class MessageServiceImpl implements IMessageService 
{
    @Autowired
    private MessageMapper messageMapper;


    @Autowired

    private AiConversationMapper conversationMapper;
    /**
     * 查询信息
     * 
     * @param messageId 信息主键
     * @return 信息
     */
    @Override
    public Message selectMessageByMessageId(Long messageId)
    {
        return messageMapper.selectMessageByMessageId(messageId);
    }


    /**
     * 查询信息列表
     * 
     * @param message 信息
     * @return 信息
     */
    @Override
    public List<Message> selectMessageList(Message message)
    {
        return messageMapper.selectMessageList(message);
    }

    /**
     * 新增信息
     * 
     * @param message 信息
     * @return 结果
     */
    @Override
    public int insertMessage(Message message)
    {
        return messageMapper.insertMessage(message);
    }

    /**
     * 修改信息
     * 
     * @param message 信息
     * @return 结果
     */
    @Override
    public int updateMessage(Message message)
    {
        return messageMapper.updateMessage(message);
    }

    /**
     * 批量删除信息
     * 
     * @param messageIds 需要删除的信息主键
     * @return 结果
     */
    @Override
    public int deleteMessageByMessageIds(Long[] messageIds)
    {
        return messageMapper.deleteMessageByMessageIds(messageIds);
    }

    /**
     * 删除信息信息
     * 
     * @param messageId 信息主键
     * @return 结果
     */
    @Override
    public int deleteMessageByMessageId(Long messageId)
    {
        return messageMapper.deleteMessageByMessageId(messageId);
    }

    @Override
    public int deleteMessageByAiConversationId(String aiConversationId) {
        messageMapper.deleteMessageByAiConversationId(aiConversationId);
        return conversationMapper.deleteAiConversationByAiConversationId(aiConversationId);
    }
}
